package szcg.scheduled.service.impl.ydcg;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import szcg.scheduled.service.service.ydcg.CasePushTimeService;

import java.util.HashMap;

@Service
public class CasePushTimeServiceImpl implements CasePushTimeService {

    @Qualifier("MainSqlSessionFactory")
    private final SqlSessionFactory sqlSessionFactory;

    public CasePushTimeServiceImpl(SqlSessionFactory sqlSessionFactory) {
        this.sqlSessionFactory = sqlSessionFactory;
    }

    @Override
    public String getTime() {
//        try (SqlSession session = sqlSessionFactory.openSession(true)) {
//            CasePushTimeMapper mapper = session.getMapper(CasePushTimeMapper.class);
//            HashMap<String, String> params = new HashMap<>();
//            params.put("queryId", "10011");
//            CasePushTimeBean time = mapper.getTime(params);
//            return time.lastUpdateTime;
//        }
        return "";
    }


    @Override
    public void saveTime(String currentTime) {
//        try (SqlSession session = sqlSessionFactory.openSession(true)) {
//            CasePushTimeMapper mapper = session.getMapper(CasePushTimeMapper.class);
//            HashMap<String, String> currentTimeParams = new HashMap<>();
//            currentTimeParams.put("queryId", "10011");
//            currentTimeParams.put("curryTime", currentTime);
//            mapper.saveTime(currentTimeParams);
//        }
    }
}
